
public class Test {
    public static void main(String[] args) {
        MyArraylist myArraylist = new MyArraylist();
        System.out.println("新增元素");
        myArraylist.add(1);
        myArraylist.add(2);
        myArraylist.add(3);
        myArraylist.add(4);
        myArraylist.display();
        System.out.println();
        System.out.println("指定位置添加元素");
        myArraylist.add(2,6);
        myArraylist.display();
        System.out.println();
        System.out.println("删除第一次出现的元素");
        myArraylist.remove(2);
        myArraylist.display();
        System.out.println();
        System.out.println("查找元素出现的位置");
        int index = myArraylist.indexOf(3);
        System.out.println("元素3下标为"+index);
        if (myArraylist.contains(5)){
            System.out.println("包含元素5");
        }else{
            System.out.println("不包含元素5");
        }
        System.out.println("更新指定位置的值");
        myArraylist.set(6,10);
        System.out.println("清空顺序表");
        myArraylist.clear();
        myArraylist.display();
        System.out.println("清空完成");
    }
}
